using System;
using System.Collections.Generic;
using System.Text;
using MacomberMap.Common.Types;
using System.Xml;

namespace MacomberMap.Common.Data
{
    /// <summary>
    /// This class holds information on the definitions for data sources
    /// </summary>
    public class MM_Data_Source:MM_Serializable
    {
        #region Variable declarations
        /// <summary>The name of the data source</summary>
        public String Name;

        /// <summary>The collection of data types from this source</summary>
        public MM_Data_Type[] DataType;
        #endregion

        #region Initialization
        /// <summary>
        /// Initilaize the data source
        /// </summary>
        /// <param name="BaseElement">The XML element definining the source</param>
        public MM_Data_Source(XmlElement BaseElement)
            : base(BaseElement)
        {
            this.Name = BaseElement.Attributes["Name"].Value;
            DataType = new MM_Data_Type[BaseElement.ChildNodes.Count];
            int a = 0;
            foreach (XmlElement xDataType in BaseElement.ChildNodes)
                DataType[a++] = new MM_Data_Type(xDataType, this);
        }
        #endregion
    }
}
